package inabit.expressioncompiler.productions;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.compiler.parser.grammar.Terminal;
import inabit.expressioncompiler.lexical.ExpressionTokenClass;
import inabit.expressioncompiler.parser.ExpressionSemanticAction;

/**N -> int_cte*/
/**@author Rafael Rocha*/
public class N_Rule extends Production{
	private Terminal int_cte;
	
	public N_Rule() {
		super("N");
	}
	
	public Symbol[] production(final NonTerminal nonTerminal) {
		int_cte = new Terminal(ExpressionTokenClass.INT_CTE);
		
		Symbol[] symbols = {
				int_cte,
				new ExpressionSemanticAction(nonTerminal) {
					
					@Override
					public void execute() throws Exception {
						nonTerminal.code = int_cte.getValue();
					}
				}
		};
		
		return symbols;
	}
	
}
